﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	x:Class="Microsoft.Research.ScientificWorkflow.SecurityControls.GlobalSettingsView"
	x:Name="Window"
	Title="globalSettings1"
	SizeToContent="WidthAndHeight" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" WindowStyle="None" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic">

	<Window.Resources>
        <DataTemplate x:Key="cmbboxTemplate">
            <TextBlock HorizontalAlignment="Left" Text="{Binding Path=DisplayName}" ToolTip="{Binding Path=DisplayName}" TextTrimming="CharacterEllipsis"/>
        </DataTemplate>
		<Style x:Key="PopupCloseButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Grid>
							<Rectangle Fill="#FFCCCCCC" Stroke="{x:Null}" RadiusX="4.5" RadiusY="4.5" x:Name="rectangle"/>
							<Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" Margin="8,3.5,7,3.5" RenderTransformOrigin="0.5,0.5">
								<Rectangle.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="-34.039"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</Rectangle.RenderTransform>
							</Rectangle>
							<Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" RenderTransformOrigin="0.5,0.5" Margin="8,3.5,7,3.5">
								<Rectangle.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="-1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="34.039"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</Rectangle.RenderTransform>
							</Rectangle>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsFocused" Value="True"/>
							<Trigger Property="IsDefaulted" Value="True"/>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Fill" TargetName="rectangle" Value="#FFADADAD"/>
							</Trigger>
							<Trigger Property="IsPressed" Value="True"/>
							<Trigger Property="IsEnabled" Value="False"/>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ComboBoxFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle SnapsToDevicePixels="true" Margin="4,4,21,4" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry>
		<Style x:Key="ComboBoxTransparentButtonStyle" TargetType="{x:Type ToggleButton}">
			<Setter Property="MinWidth" Value="0"/>
			<Setter Property="MinHeight" Value="0"/>
			<Setter Property="Width" Value="Auto"/>
			<Setter Property="Height" Value="Auto"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderBrush" Value="{x:Static Microsoft_Windows_Themes:ClassicBorderDecorator.ClassicBorderBrush}"/>
			<Setter Property="BorderThickness" Value="2"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ToggleButton}">
						<DockPanel SnapsToDevicePixels="true" Background="{TemplateBinding Background}" LastChildFill="false">
							<Microsoft_Windows_Themes:ClassicBorderDecorator x:Name="Border" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
								<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource DownArrowGeometry}"/>
							</Microsoft_Windows_Themes:ClassicBorderDecorator>
						</DockPanel>
						<ControlTemplate.Triggers>
							<Trigger Property="IsChecked" Value="true">
								<Setter Property="BorderStyle" TargetName="Border" Value="AltPressed"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
				</Trigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
			<Setter Property="OverridesDefaultStyle" Value="true"/>
			<Setter Property="AllowDrop" Value="true"/>
			<Setter Property="MinWidth" Value="0"/>
			<Setter Property="MinHeight" Value="0"/>
			<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TextBox}">
						<ScrollViewer Focusable="false" Background="Transparent" x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
			<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
				<Grid>
					<Microsoft_Windows_Themes:ClassicBorderDecorator x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{x:Static Microsoft_Windows_Themes:ClassicBorderDecorator.ClassicBorderBrush}" BorderStyle="Sunken" BorderThickness="2">
						<Popup Focusable="False" AllowsTransparency="true" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" x:Name="PART_Popup">
							<Microsoft_Windows_Themes:SystemDropShadowChrome MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding Path=ActualWidth, ElementName=Border}" x:Name="Shdw" Color="Transparent">
								<Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
									<ScrollViewer>
										<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
									</ScrollViewer>
								</Border>
							</Microsoft_Windows_Themes:SystemDropShadowChrome>
						</Popup>
					</Microsoft_Windows_Themes:ClassicBorderDecorator>
					<ToggleButton Focusable="false" Margin="2" MinHeight="0" MinWidth="0" Style="{StaticResource ComboBoxTransparentButtonStyle}" Width="Auto" ClickMode="Press" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
					<DockPanel Margin="2">
						<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right"/>
						<TextBox HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="PART_EditableTextBox" Style="{StaticResource ComboBoxEditableTextBox}" IsReadOnly="{Binding Path=IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"/>
					</DockPanel>
				</Grid>
			</Border>
			<ControlTemplate.Triggers>
				<Trigger Property="HasItems" Value="false">
					<Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
				</Trigger>
				<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
					<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
					<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
				</Trigger>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
					<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
				</Trigger>
				<Trigger Property="IsGrouping" Value="true">
					<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="Margin" Value="0,0,0,0"/>
			<Setter Property="Padding" Value="2,1"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ComboBox}">
						<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
							<Grid>
								<Microsoft_Windows_Themes:ClassicBorderDecorator x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{x:Static Microsoft_Windows_Themes:ClassicBorderDecorator.ClassicBorderBrush}" BorderStyle="Sunken" BorderThickness="2">
									<Popup Focusable="False" AllowsTransparency="true" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" x:Name="PART_Popup" MaxWidth="300">
										<Microsoft_Windows_Themes:SystemDropShadowChrome MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding Path=ActualWidth, ElementName=Border}" x:Name="Shdw" Color="Transparent">
											<Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" MaxWidth="300" ScrollViewer.VerticalScrollBarVisibility="Disabled">
												<ScrollViewer HorizontalScrollBarVisibility="Disabled">
													<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained" ScrollViewer.VerticalScrollBarVisibility="Auto" />
												</ScrollViewer>
											</Border>
										</Microsoft_Windows_Themes:SystemDropShadowChrome>
									</Popup>
								</Microsoft_Windows_Themes:ClassicBorderDecorator>
								<DockPanel Margin="2">
									<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right"/>
									<Border Margin="{TemplateBinding Padding}" x:Name="SelectedItemBorder">
										<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,1,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" d:IsHidden="True" x:Name="contentPresenter"/>
									</Border>
								</DockPanel>
								<ToggleButton Focusable="false" Margin="2" MinHeight="0" MinWidth="0" Style="{StaticResource ComboBoxTransparentButtonStyle}" Width="Auto" ClickMode="Press" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
							</Grid>
						</Border>
						<ControlTemplate.Triggers>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelectionBoxHighlighted" Value="true"/>
									<Condition Property="IsDropDownOpen" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
							</MultiTrigger>
							<Trigger Property="IsSelectionBoxHighlighted" Value="true">
								<Setter Property="Background" TargetName="SelectedItemBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
							</Trigger>
							<Trigger Property="HasItems" Value="false">
								<Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
							</Trigger>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
								<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
							</Trigger>
							<Trigger Property="IsGrouping" Value="true">
								<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
							</Trigger>
							<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
								<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
								<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsEditable" Value="true">
					<Setter Property="IsTabStop" Value="false"/>
					<Setter Property="Padding" Value="1"/>
					<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
				</Trigger>
			</Style.Triggers>
		</Style>
	</Window.Resources>

	<Grid x:Name="LayoutRoot">
		<Border BorderBrush="#FFBDBDBD" BorderThickness="1,1,2,2" CornerRadius="4,4,4,4">
			<Border.Background>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FFF7F7F7" Offset="0"/>
					<GradientStop Color="#FFE9E9E9" Offset="1"/>
				</LinearGradientBrush>
			</Border.Background>
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="28"/>
					<RowDefinition Height="*"/>
					<RowDefinition Height="38"/>
				</Grid.RowDefinitions>
				<Border Name="brdrHeader" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="0" CornerRadius="4,4,0,0">
					<Border.Background>
						<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
							<GradientStop Color="#FFF7F7F7" Offset="0"/>
							<GradientStop Color="#FFE9E9E9" Offset="1"/>
						</LinearGradientBrush>
					</Border.Background>
					<Grid>
						<TextBlock HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" Foreground="#FF5F5F5F" Text="Global Settings" TextWrapping="Wrap"/>
						<Button HorizontalAlignment="Right" Margin="0,5.5,5,5.5" Style="{DynamicResource PopupCloseButton}" Width="17" Content="Button" Command="{Binding Path=CloseGlobalSettingWindowCommand}"/>
					</Grid>
				</Border>
				<Button IsCancel="True" HorizontalAlignment="Right" Width="70" Content="Cancel" Margin="0,0,10,0" VerticalAlignment="Center" Grid.Row="2" Command="{Binding Path=CloseGlobalSettingWindowCommand}"/>
				<Button IsDefault="True" HorizontalAlignment="Right" Width="70" Content="OK" Margin="0,0,85,0" VerticalAlignment="Center" Grid.Row="2" d:LayoutOverrides="Height" Command="{Binding Path=SaveSettingsCommand}" IsEnabled="{Binding Path=IsSourceSelected}"/>
				<Border Grid.Row="1" Background="#FFF1F1F1">
					<ScrollViewer VerticalScrollBarVisibility="Auto">
						<StackPanel Margin="10,0,10,0">
							<Grid HorizontalAlignment="Stretch" Margin="10,10,10,10">
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" MinHeight="22.16"/>
									<RowDefinition Height="Auto"/>
								</Grid.RowDefinitions>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="157"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<TextBlock Text="Select External Registry:" TextWrapping="Wrap" VerticalAlignment="Top" d:LayoutOverrides="Width" HorizontalAlignment="Left" Margin="0,5,0,0" Grid.RowSpan="1"/>
								<ComboBox IsSynchronizedWithCurrentItem="True" d:LayoutOverrides="Height" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Left" Width="160" Margin="0,5,0,0" SelectedItem ="{Binding Path=SelectedSource}" ItemsSource="{Binding Path=dataSourceList}" ItemTemplate="{StaticResource cmbboxTemplate}" HorizontalContentAlignment="Left" Style="{DynamicResource ComboBoxStyle}" ToolTip="{Binding Path=SelectedSource.DisplayName}" x:Name="comboBox"/>
								<TextBlock Text="Data Product Storage Value:" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0,0,0,5"/>
								<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1" Margin="0,7,0,0">
									<StackPanel VerticalAlignment="Stretch">
										<TextBlock Text="Min" TextWrapping="Wrap" d:LayoutOverrides="Height" HorizontalAlignment="Left" VerticalAlignment="Top" />
										<TextBox Text="{Binding Path=MinValue}" TextWrapping="NoWrap" d:LayoutOverrides="Height" HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" AutomationProperties.AutomationId="AIMinValue"/>
									</StackPanel>
									<StackPanel d:LayoutOverrides="Height" Margin="2,0,0,4" VerticalAlignment="Bottom">
										<TextBlock Text="KB" TextWrapping="Wrap" d:LayoutOverrides="Height" HorizontalAlignment="Left" VerticalAlignment="Bottom" RenderTransformOrigin="0.457,2.163"/>
									</StackPanel>
									<StackPanel Width="50" Height="32.553" Margin="12,0,0,0">
										<TextBlock Text="Max" TextWrapping="Wrap" d:LayoutOverrides="Height" HorizontalAlignment="Left" VerticalAlignment="Top"/>
										<TextBox Text="{Binding Path=MaxValue}" TextWrapping="NoWrap" d:LayoutOverrides="Height" HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" AutomationProperties.AutomationId="AIMaxValue"/>
									</StackPanel>
									<StackPanel Width="Auto" Height="Auto" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="2,0,0,4">
										<TextBlock Text="KB" TextWrapping="Wrap" d:LayoutOverrides="Height" HorizontalAlignment="Left" VerticalAlignment="Center"/>
									</StackPanel>
								</StackPanel>
							</Grid>
						</StackPanel>
					</ScrollViewer>
				</Border>
			</Grid>
		</Border>
	</Grid>
</Window>